<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>FTP Overview | YiChangKong For Blog</title><meta name="keywords" content="技术文档"><meta name="author" content="伊长空"><meta name="copyright" content="伊长空"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="File Transfer Protocol（ 文件传输协议） The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network. FTP is built">
<meta property="og:type" content="article">
<meta property="og:title" content="FTP Overview">
<meta property="og:url" content="https://yichangkong.gitee.io/2020/11/12/FTP%20Overview/index.html">
<meta property="og:site_name" content="YiChangKong For Blog">
<meta property="og:description" content="File Transfer Protocol（ 文件传输协议） The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network. FTP is built">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg">
<meta property="article:published_time" content="2020-11-12T08:34:58.000Z">
<meta property="article:modified_time" content="2020-11-23T12:18:52.063Z">
<meta property="article:author" content="伊长空">
<meta property="article:tag" content="技术文档">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://yichangkong.gitee.io/2020/11/12/FTP%20Overview/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  ClickShowText: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-11-23 20:18:52'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'false'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}})()</script><meta name="generator" content="Hexo 5.2.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200417183933.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">45</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">45</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div></div></div></div><div id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">YiChangKong For Blog</a></span><span id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="post-info"><h1 class="post-title">FTP Overview</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-11-12T08:34:58.000Z" title="发表于 2020-11-12 16:34:58">2020-11-12</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-11-23T12:18:52.063Z" title="更新于 2020-11-23 20:18:52">2020-11-23</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Protocol/">Protocol</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Protocol/File-Transfer/">File Transfer</a></span></div><div class="meta-secondline"> <span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="File-Transfer-Protocol（-文件传输协议）"><a href="#File-Transfer-Protocol（-文件传输协议）" class="headerlink" title="File Transfer Protocol（ 文件传输协议）"></a>File Transfer Protocol（ 文件传输协议）</h2><blockquote>
<p>The <strong>File Transfer Protocol</strong> (<strong>FTP</strong>) is a standard <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Network_protocol">network protocol</a> used for the transfer of <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Computer_file">computer files</a> between <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Client%E2%80%93server_model">a client and server</a> on a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Computer_network">computer network</a>.</p>
<p>FTP is built on a client-server model architecture using separate control and data connections between the client and the server.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-for-1">1]</a> FTP users may authenticate themselves with a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Clear_text">clear-text</a> sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. For secure transmission that protects the username and password, and encrypts the content, FTP is often <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#Security">secured</a> with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Transport_Layer_Security">SSL/TLS</a> (<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/FTPS">FTPS</a>) or replaced with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SSH File Transfer Protocol</a> (SFTP).</p>
<p>The first FTP client applications were <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Command-line_interface">command-line programs</a> developed before <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Operating_system">operating systems</a> had <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Graphical_user_interface">graphical user interfaces</a>, and are still shipped with most <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Windows">Windows</a>, <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Unix">Unix</a>, and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Linux">Linux</a> operating systems.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-net+-3">3]</a> Many FTP clients and automation utilities have since been developed for <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Desktop_computer">desktops</a>, servers, mobile devices, and hardware, and FTP has been incorporated into productivity applications, such as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/HTML_editor">HTML editors</a>.</p>
<p><strong>Chinese</strong></p>
<p>文件传输协议（FTP）是一种标准的网络协议，用于在计算机网络上的客户端和服务器之间传输计算机文件。</p>
<p>FTP建立在客户端-服务器模型架构上，在客户端和服务器之间使用单独的控制和数据连接。</p>
<p>[1] FTP用户可以使用明文登录协议对自己进行身份验证，通常以用户名和密码的形式进行身份验证，但是如果服务器配置为允许，则可以匿名连接。</p>
<p>为了保护用户名和密码以及对内容进行加密的安全传输，通常使用SSL / TLS（FTPS）来保护FTP或使用SSH文件传输协议（SFTP）来代替FTP。</p>
<p>第一个FTP客户端应用程序是在操作系统具有图形用户界面之前开发的命令行程序，并且仍随大多数Windows，Unix和Linux操作系统一起提供。</p>
<p>[2] [3]此后，已经为台式机，服务器，移动设备和硬件开发了许多FTP客户端和自动化实用程序，并且FTP已被合并到生产力应用程序中，例如HTML编辑器。</p>
</blockquote>
<h2 id="History-of-FTP-servers"><a href="#History-of-FTP-servers" class="headerlink" title="History of FTP servers"></a>History of FTP servers</h2><blockquote>
<p>The original specification for the File Transfer Protocol was written by <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Abhay_Bhushan">Abhay Bhushan</a> and published as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc114">114</a> on 16 April 1971. Until 1980, FTP ran on <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Network_Control_Program">NCP</a>, the predecessor of <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Internet_protocol_suite">TCP/IP</a>.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a> The protocol was later replaced by a TCP/IP version, <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc765">765</a> (June 1980) and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc959">959</a> (October 1985), the current specification. Several proposed standards amend <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc959">959</a>, for example <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc1579">1579</a> (February 1994) enables Firewall-Friendly FTP (passive mode), <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc2228">2228</a> (June 1997) proposes security extensions, <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc2428">2428</a> (September 1998) adds support for <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/IPv6">IPv6</a> and defines a new type of passive mode.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-clark-4">4]</a></p>
<p><strong>Chinese</strong><br>FTP服务器的历史<br>文件传输协议的原始规范由Abhay Bhushan撰写，并于1971年4月16日以RFC 114的形式发布。直到1980年，<strong>FTP都在TCP / IP的前身NCP上运行</strong>。</p>
<p>[2] 该协议后来被当前规范的TCP / IP版本RFC 765（1980年6月）和RFC 959（1985年10月）代替。 几个提议的标准对RFC 959进行了修订，例如RFC 1579（1994年2月）启用了防火墙友好的FTP（被动模式），RFC 2228（1997年6月）提出了安全性扩展，RFC 2428（1998年9月）增加了对IPv6的支持并定义了一种新类型 被动模式。[4]</p>
</blockquote>
<h2 id="Protocol-overview-（协议概述）"><a href="#Protocol-overview-（协议概述）" class="headerlink" title="Protocol overview （协议概述）"></a>Protocol overview （协议概述）</h2><h3 id="Communication-and-data-transfer-（通讯和数据传输）"><a href="#Communication-and-data-transfer-（通讯和数据传输）" class="headerlink" title="Communication and data transfer （通讯和数据传输）"></a>Communication and data transfer （通讯和数据传输）</h3><blockquote>
<p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200912225412.png"><img src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200912225412.png" alt="img"></a></p>
<p>Illustration of starting a passive connection using port 21</p>
<p>FTP may run in <em>active</em> or <em>passive</em> mode, which determines how the data connection is established.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-slack-5">5]</a> (Note, somewhat confusingly, this sense of “mode” is <em>different</em> from that of the MODE command in the FTP protocol, and actually corresponds to the PORT/PASV/EPSV/etc commands instead.) In both cases, the client creates a TCP control connection from a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Ephemeral_port">random, usually an unprivileged</a>, <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Port_(computer_networking)">port</a> N to the FTP server command port 21.</p>
<ul>
<li>In active mode, the client starts listening for incoming data connections from the server on port M. It sends the FTP command PORT M to inform the server on which port it is listening. The server then initiates a data channel to the client from its port 20, the FTP server data port.</li>
<li>In situations where the client is behind a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Firewall_(computing)">firewall</a> and unable to accept incoming TCP connections, <em>passive mode</em> may be used. In this mode, the client uses the control connection to send a PASV command to the server and then receives a server IP address and server port number from the server,[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-slack-5">5]</a> which the client then uses to open a data connection from an arbitrary client port to the server IP address and server port number received.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-postel-6">6]</a></li>
</ul>
<p>Both modes were updated in September 1998 to support <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/IPv6">IPv6</a>. Further changes were introduced to the passive mode at that time, updating it to <em>extended passive mode</em>.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-7">7]</a></p>
<p>The server responds over the control connection with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/List_of_FTP_server_return_codes">three-digit status codes</a> in ASCII with an optional text message. For example, “200” (or “200 OK”) means that the last command was successful. The numbers represent the code for the response and the optional text represents a human-readable explanation or request (e.g. ).[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-for-1">1]</a> An ongoing transfer of file data over the data connection can be aborted using an interrupt message sent over the control connection.</p>
<p>The reason why FTP needs two ports (one for sending and one for receiving) is due to the fact that it was originally designed to operate on <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Network_Control_Program">Network Control Program</a> (NCP), which was a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Simplex_communication">simplex protocol</a> that utilized two <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers">port addresses</a>, establishing two connections, for two-way communications. An odd and an even port were reserved for each <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Application_layer">application layer</a> application or protocol. The standardization of TCP and UDP reduced the need for the use of two simplex ports for each application down to one duplex port,[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-stevens1994v1-8">8]</a>:15 but the FTP protocol was never altered to only use one port, but continued using two for backwards compatibility.</p>
<p><strong>Chinese</strong></p>
<p>FTP可能以主动或被动模式运行，这决定了如何建立数据连接。[5] （注意，有些令人困惑，这种“模式”的含义与FTP协议中的MODE命令的含义不同，并且实际上对应于PORT / PASV / EPSV / etc命令。）在两种情况下，客户端都创建一个TCP控制连接，从随机的（通常是非特权的）端口N到FTP服务器命令端口21。</p>
<ul>
<li>在活动模式下，客户端开始侦听端口M上来自服务器的传入数据连接。它发送FTP命令PORT M来通知服务器正在侦听的端口。然后，服务器从其端口20（FTP服务器数据端口）启动到客户端的数据通道。</li>
<li>在客户端位于防火墙后面且无法接受传入的TCP连接的情况下，可以使用被动模式。在此模式下，客户端使用控制连接向服务器发送PASV命令，然后从服务器接收服务器IP地址和服务器端口号，[5]然后，客户端将其用于从任意客户端打开数据连接端口到接收到的服务器IP地址和服务器端口号。[6]</li>
</ul>
<p>两种模式都在1998年9月进行了更新，以支持IPv6。当时，对被动模式进行了进一步的更改，将其更新为扩展的被动模式。[7]</p>
<p>服务器通过控制连接响应ASCII码的三位数状态代码以及可选的文本消息。例如，“ 200”（或“ 200 OK”）表示最后一个命令成功。数字代表响应代码，可选文本代表易于理解的说明或请求（例如&lt;存储文件所需的帐户&gt;）。[1]通过控制连接发送的中断消息可以中止通过数据连接正在进行的文件数据传输。</p>
<p>FTP之所以需要两个端口<strong>（一个用于发送，一个用于接收）</strong>的原因是由于它最初是为在网络控制程序（NCP）上运行而设计的，该协议是一种单纯的协议，它利用了两个端口地址，建立了两个连接，用于双向通讯。为每个应用程序层应用程序或协议保留了奇数和偶数端口。 TCP和UDP的标准化将每个应用程序使用两个单一端口的需求降低到一个双工端口，[8]：15，<strong>但FTP协议从未更改为仅使用一个端口，而是继续使用两个以实现向后兼容性。</strong></p>
</blockquote>
<h3 id="NAT-and-firewall-traversal（NAT-和-防火墙穿越）"><a href="#NAT-and-firewall-traversal（NAT-和-防火墙穿越）" class="headerlink" title="NAT and firewall traversal（NAT 和 防火墙穿越）"></a>NAT and firewall traversal（NAT 和 防火墙穿越）</h3><blockquote>
<p>FTP normally transfers data by having the server connect back to the client, after the PORT command is sent by the client. This is problematic for both <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Network_address_translation">NATs</a> and firewalls, which do not allow connections from the Internet towards internal hosts.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-ncftp-9">9]</a> For NATs, an additional complication is that the representation of the IP addresses and port number in the PORT command refer to the internal host’s IP address and port, rather than the public IP address and port of the NAT.</p>
<p>There are two approaches to solve this problem. One is that the FTP client and FTP server use the PASV command, which causes the data connection to be established from the FTP client to the server.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-ncftp-9">9]</a> This is widely used by modern FTP clients. Another approach is for the NAT to alter the values of the PORT command, using an <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Application-level_gateway">application-level gateway</a> for this purpose.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-ncftp-9">9]</a></p>
<p><strong>Chinese</strong><br>在客户端发送PORT命令之后，FTP通常通过使服务器重新连接到客户端来传输数据。 这对于NAT和防火墙都是有问题的，它们不允许从Internet到内部主机的连接。[9] 对于NAT，另一个麻烦是PORT命令中IP地址和端口号的表示是指内部主机的IP地址和端口，而不是NAT的公用IP地址和端口。</p>
<p>有两种方法可以解决此问题。 一种是FTP客户端和FTP服务器使用PASV命令，这将导致从FTP客户端到服务器的数据连接建立。 这是现代FTP客户端广泛使用的。 NAT的另一种方法是使用应用级网关为此目的更改PORT命令的值。</p>
<h3 id="Data-types（数据类型）"><a href="#Data-types（数据类型）" class="headerlink" title="Data types（数据类型）"></a>Data types（数据类型）</h3><p>While transferring data over the network, four data types are defined:[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-net+-3">3]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-clark-4">4]</a></p>
<ul>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> (TYPE A): Used for text. Data is converted, if needed, from the sending host’s character representation to <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Extended_ASCII">“8-bit ASCII”</a> before transmission, and (again, if necessary) to the receiving host’s character representation. As a consequence, this mode is inappropriate for files that contain data other than plain text.</li>
<li>Image (TYPE I, commonly called <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Binary_data">Binary</a> mode): The sending machine sends each file <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Byte">byte</a> by byte, and the recipient stores the <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Bytestream">bytestream</a> as it receives it. (Image mode support has been recommended for all implementations of FTP).</li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/EBCDIC">EBCDIC</a> (TYPE E): Used for plain text between hosts using the EBCDIC character set.</li>
<li>Local (TYPE L <em>n</em>): Designed to support file transfer between machines which do not use 8-bit bytes, e.g. <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/36-bit_computing">36-bit systems</a> such as DEC <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/PDP-10">PDP-10s</a>. For example, “TYPE L 9” would be used to transfer data in 9-bit bytes, or “TYPE L 36” to transfer 36-bit words. Most contemporary FTP clients/servers only support L 8, which is equivalent to I.</li>
</ul>
<p>An expired <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Internet_Draft">Internet Draft</a> defined a TYPE U for transferring <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Unicode">Unicode</a> text files using <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/UTF-8">UTF-8</a>;[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-10">10]</a> although the draft never became an RFC, it has been implemented by several FTP clients/servers.</p>
<p>Note these data types are commonly called “modes”, although ambiguously that word is also used to refer to active-vs-passive communication mode (see above), and the modes set by the FTP protocol MODE command (see below).</p>
<p>For text files (TYPE A and TYPE E), three different format control options are provided, to control how the file would be printed:</p>
<ul>
<li>Non-print (TYPE A N and TYPE E N) – the file does not contain any carriage control characters intended for a printer</li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Telnet">Telnet</a> (TYPE A T and TYPE E T) – the file contains Telnet (or in other words, ASCII C0) carriage control characters (CR, LF, etc)</li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/ASA_carriage_control_characters">ASA</a> (TYPE A A and TYPE E A) – the file contains ASA carriage control characters</li>
</ul>
<p>These formats were mainly relevant to <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Line_printer">line printers</a>; most contemporary FTP clients/servers only support the default format control of N.</p>
<p><strong>Chinese</strong></p>
<p>通过网络传输数据时，定义了四种数据类型：</p>
<ul>
<li><p>ASCII（TYPE A）：用于文本。必要时，数据在传输之前从发送主机的字符表示形式转换为“ 8位ASCII”，并（必要时再次）转换为接收主机的字符表示形式。因此，此模式不适用于包含非纯文本数据的文件。</p>
</li>
<li><p>Image（类型I，通常称为二进制模式）：发送方的计算机将逐字节发送每个文件，而接收方在接收字节流时将其存储。 （建议对FTP的所有实现都使用图像模式支持）。</p>
</li>
<li><p>EBCDIC（TYPE E）：用于使用EBCDIC字符集的主机之间的纯文本。</p>
</li>
<li><p>Local（TYPE L n）：设计为支持在不使用8位字节的机器之间进行文件传输，例如36位系统，例如DEC PDP-10。例如，“ TYPE L 9”将用于传输9位字节的数据，或者使用“ TYPE L 36”来传输36位字。大多数当代的FTP客户端/服务器仅支持L 8，它等效于I。</p>
<p>过期的Internet草案定义了使用UTF-8传输Unicode文本文件的TYPE U； [10]尽管该草案从未成为RFC，但已由多个FTP客户端/服务器实现。</p>
<p>请注意，这些数据类型通常被称为“模式”，尽管这个词也常常被用来表示主动与被动通信模式（请参见上文）以及由FTP协议MODE命令设置的模式（请参见下文）。对于文本文件（TYPE A和TYPE E），提供了三种不同的格式控制选项，以控制文件的打印方式：</p>
</li>
<li><p>Non-print（TYPE A N和TYPE E N）–该文件不包含任何用于打印机的笔架控制字符</p>
</li>
<li><p>Telnet（TYPE A T和TYPE E T）–文件包含Telnet（或ASCII C0）回车控制字符（CR，LF等）</p>
</li>
<li><p>ASA（TYPE A A和TYPE E A）–文件包含ASA托架控制字符这些格式主要与行式打印机有关。大多数现代的FTP客户端/服务器仅支持默认格式N。</p>
</li>
</ul>
</blockquote>
<h3 id="File-structures（文件结构）"><a href="#File-structures（文件结构）" class="headerlink" title="File structures（文件结构）"></a>File structures（文件结构）</h3><blockquote>
<p>File organization is specified using the STRU command. The following file structures are defined in section 3.1.1 of RFC959:</p>
<ul>
<li><strong>F</strong> or FILE structure (stream-oriented). Files are viewed as an arbitrary sequence of bytes, characters or words. This is the usual file structure on Unix systems and other systems such as CP/M, MSDOS and Microsoft Windows. (Section 3.1.1.1)</li>
<li><strong>R</strong> or RECORD structure (record-oriented). Files are viewed as divided into records, which may be fixed or variable length. This file organization is common on mainframe and midrange systems, such as MVS, VM/CMS, OS/400 and VMS, which support <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Record-oriented_filesystem">record-oriented filesystems</a>.</li>
<li><strong>P</strong> or PAGE structure (page-oriented). Files are divided into pages, which may either contain data or metadata; each page may also have a header giving various attributes. This file structure was specifically designed for <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/TENEX_(operating_system)">TENEX</a> systems, and is generally not supported on other platforms. RFC1123 section 4.1.2.3 recommends that this structure not be implemented.</li>
</ul>
<p>Most contemporary FTP clients and servers only support STRU F. STRU R is still in use in mainframe and minicomputer file transfer applications.</p>
<p><strong>Chinese</strong><br>使用STRU命令指定文件组织。 RFC959的3.1.1节中定义了以下文件结构：</p>
<ul>
<li>F或FILE结构（面向流）。文件被视为字节，字符或单词的任意序列。这是Unix系统和其他系统（例如CP / M，MSDOS和Microsoft Windows）上的常用文件结构。 （第3.1.1.1节）</li>
<li>R或RECORD结构（面向记录）。文件被视为分为记录，记录可以是固定长度或可变长度。这种文件组织在大型机和中型系统（例如MVS，VM / CMS，OS / 400和VMS）上很常见，它们支持面向记录的文件系统。</li>
<li>P或PAGE结构（面向页面）。文件分为页面，页面可以包含数据或元数据。每个页面还可以具有提供各种属性的标题。该文件结构是专为TENEX系统设计的，通常在其他平台上不受支持。 RFC1123第4.1.2.3节建议不要实现此结构。<br>大多数现代的FTP客户端和服务器仅支持STRUF。STRUR仍在大型机和小型计算机文件传输应用程序中使用。</li>
</ul>
</blockquote>
<h3 id="Data-transfer-modes-（数据传输模型-方式）"><a href="#Data-transfer-modes-（数据传输模型-方式）" class="headerlink" title="Data transfer modes （数据传输模型\方式）"></a>Data transfer modes （数据传输模型\方式）</h3><blockquote>
<p>Data transfer can be done in any of three modes:[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-for-1">1]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a></p>
<ul>
<li>Stream mode (MODE S): Data is sent as a continuous stream, relieving FTP from doing any processing. Rather, all processing is left up to <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a>. No End-of-file indicator is needed, unless the data is divided into <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Record_(computer_science)">records</a>.</li>
<li>Block mode (MODE B): Designed primarily for transferring record-oriented files (STRU R), although can also be used to transfer stream-oriented (STRU F) text files. FTP puts each record (or line) of data into several blocks (block header, byte count, and data field) and then passes it on to TCP.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-clark-4">4]</a></li>
<li>Compressed mode (MODE C): Extends MODE B with data compression using <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Run-length_encoding">run-length encoding</a>.</li>
</ul>
<p>Most contemporary FTP clients and servers do not implement MODE B or MODE C; FTP clients and servers for mainframe and minicomputer operating systems are the exception to that.</p>
<p>Some FTP software also implements a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/DEFLATE">DEFLATE</a>-based compressed mode, sometimes called “Mode Z” after the command that enables it. This mode was described in an <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Internet_Draft">Internet Draft</a>, but not standardized.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-11">11]</a></p>
<p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/GridFTP">GridFTP</a> defines additional modes, MODE E[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-12">12]</a> and MODE X,[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-13">13]</a> as extensions of MODE B.</p>
<p><strong>Chinese</strong><br>数据传输可以通过以下三种模式之一进行：</p>
<p>流模式（模式S）：数据以连续流的形式发送，从而使FTP不再进行任何处理。而是，所有处理都由TCP完成。除非数据分为记录，否则不需要文件结束指示符。<br>块模式（MODE B）：主要设计用于传输面向记录的文件（STRU R），尽管也可以用于传输面向流（STRU F）的文本文件。 FTP将数据的每个记录（或行）放入几个块（块头，字节数和数据字段）中，然后将其传递到TCP。<br>压缩模式（MODE C）：使用游程编码对数据压缩进行扩展以扩展MODEB。<br>大多数现代的FTP客户端和服务器都未实现MODE B或MODEC。大型机和小型计算机操作系统的FTP客户端和服务器除外。</p>
<p>一些FTP软件还实现了基于DEFLATE的压缩模式，有时在启用它的命令后称为“模式Z”。 Internet草案中对此模式进行了描述，但未对其进行标准化。</p>
<p>GridFTP将其他模式MODE E [12]和MODE X，[13]定义为MODE B的扩展。</p>
</blockquote>
<h2 id="Login-（登陆）"><a href="#Login-（登陆）" class="headerlink" title="Login （登陆）"></a>Login （登陆）</h2><blockquote>
<p>FTP login uses normal username and password scheme for granting access.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a> The username is sent to the server using the USER command, and the password is sent using the PASS command.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a> This sequence is unencrypted “on the wire”, so may be vulnerable to a network <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Sniffing_attack">sniffing attack</a>.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-14">14]</a> If the information provided by the client is accepted by the server, the server will send a greeting to the client and the session will commence.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a> If the server supports it, users may log in without providing login credentials, but the same server may authorize only limited access for such sessions.[[2]</p>
<p><strong>Chinese</strong></p>
<p>FTP登录使用普通的用户名和密码方案来授予访问权限。</p>
<p>用户名使用USER命令发送到服务器，密码使用PASS命令发送。 此序列“在线”未加密，因此可能容易受到网络嗅探攻击。 如果服务器接受了客户端提供的信息，则服务器将向客户端发送问候语，会话将开始。 如果服务器支持，则用户可以在不提供登录凭据的情况下登录，但是同一服务器可以仅授权对此类会话的有限访问。</p>
</blockquote>
<h3 id="Anonymous-FTP-（匿名-FTP）"><a href="#Anonymous-FTP-（匿名-FTP）" class="headerlink" title="Anonymous FTP （匿名 FTP）"></a>Anonymous FTP （匿名 FTP）</h3><blockquote>
<p>A host that provides an FTP service may provide <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Anonymity">anonymous</a> FTP access.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a> Users typically log into the service with an ‘anonymous’ (lower-case and case-sensitive in some FTP servers) account when prompted for user name. Although users are commonly asked to send their <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Email">email</a> address instead of a password,[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-net+-3">3]</a> no verification is actually performed on the supplied data.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-rfc16-15">15]</a> Many FTP hosts whose purpose is to provide software updates will allow anonymous logins.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-net+-3">3]</a></p>
<p>提供FTP服务的主机可以提供匿名FTP访问。[2] 提示用户输入用户名时，用户通常使用“匿名”（小写且区分大小写）帐户登录服务。 尽管通常要求用户发送电子邮件地址而不是密码，[3]实际上并没有对提供的数据进行验证。[15] 许多旨在提供软件更新的FTP主机都允许匿名登录。</p>
</blockquote>
<h2 id="Differences-from-HTTP-（与HTTP的不同之处）"><a href="#Differences-from-HTTP-（与HTTP的不同之处）" class="headerlink" title="Differences from HTTP （与HTTP的不同之处）"></a>Differences from HTTP （与HTTP的不同之处）</h2><blockquote>
<p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a> essentially fixes the bugs in FTP that made it inconvenient to use for many small ephemeral transfers as are typical in web pages.</p>
<p>FTP has a stateful control connection which maintains a current working directory and other flags, and each transfer requires a secondary connection through which the data are transferred. In “passive” mode this secondary connection is from client to server, whereas in the default “active” mode this connection is from server to client. This apparent role reversal when in active mode, and random port numbers for all transfers, is why firewalls and NAT gateways have such a hard time with FTP. HTTP is stateless and multiplexes control and data over a single connection from client to server on well-known port numbers, which trivially passes through NAT gateways and is simple for firewalls to manage.</p>
<p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://gitee.com/yichangkong/FigureBed/raw/master/img/HTTP-Request-and-Response-Over-Web-1.webp"><img src="https://gitee.com/yichangkong/FigureBed/raw/master/img/HTTP-Request-and-Response-Over-Web-1.webp" alt="HTTP-Request-and-Response-Over-Web-1"></a></p>
<p>Setting up an FTP control connection is quite slow due to the round-trip delays of sending all of the required commands and awaiting responses, so it is customary to bring up a control connection and hold it open for multiple file transfers rather than drop and re-establish the session afresh each time. In contrast, HTTP originally dropped the connection after each transfer because doing so was so cheap. While HTTP has subsequently gained the ability to reuse the TCP connection for multiple transfers, the conceptual model is still of independent requests rather than a session.</p>
<p>When FTP is transferring over the data connection, the control connection is idle. If the transfer takes too long, the firewall or NAT may decide that the control connection is dead and stop tracking it, effectively breaking the connection and confusing the download. The single HTTP connection is only idle between requests and it is normal and expected for such connections to be dropped after a time-out.</p>
<p><strong>HTTP本质上修复了FTP中的错误，这些错误使它不方便用于网页中常见的许多小型临时传输。</strong></p>
<p>FTP具有<strong>状态控制连接</strong>，该连接维护当前工作目录和其他标志，并且每次传输都需要辅助连接，通过该辅助连接可以传输数据。在“被动”模式下，此辅助连接是从客户端到服务器，而在默认的“主动”模式下，此连接是从服务器到客户端。在活动模式下这种明显的角色转换以及所有传输的随机端口号是防火墙和NAT网关使用FTP如此困难的原因。 HTTP是无状态的，并且通过众所周知的端口号通过从客户端到服务器的单个连接多路复用控制和数据，这些端口可轻松通过NAT网关，防火墙易于管理。</p>
<p>由于发送所有必需命令和等待响应的往返 延迟，建立FTP控制连接的速度非常慢，因此习惯上要建立一个控制连接并将其保持打开状态以进行多次文件传输，而不是丢弃然后重新打开-每次重新建立会话。相反，HTTP每次传输后最初都删除了连接，因为这样做非常便宜。虽然HTTP随后具有重用TCP连接进行多次传输的能力，但是概念模型仍然是独立的请求而不是会话。</p>
<p>当FTP通过数据连接传输时，控制连接处于空闲状态。如果传输时间太长，则防火墙或NAT可能会确定控制连接已死并停止对其进行跟踪，从而有效地断开了连接并导致下载混乱。单个HTTP连接仅在请求之间是空闲的，并且正常的并且期望此类连接在超时后被丢弃。</p>
</blockquote>
<h2 id="Web-browser-support-（网站浏览器支持）"><a href="#Web-browser-support-（网站浏览器支持）" class="headerlink" title="Web browser support （网站浏览器支持）"></a>Web browser support （网站浏览器支持）</h2><blockquote>
<p>Most common <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Web_browser">web browsers</a> can retrieve files hosted on FTP servers, although they may not support protocol extensions such as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/FTPS">FTPS</a>.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-net+-3">3]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-matthews-16">16]</a> When an FTP—rather than an HTTP—<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/URL">URL</a> is supplied, the accessible contents on the remote server are presented in a manner that is similar to that used for other web content. A full-featured FTP client can be run within <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Firefox">Firefox</a> in the form of an extension called <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/FireFTP">FireFTP</a>.</p>
<p>As of 2019, major browsers such as Chrome and Firefox are deprecating FTP support to varying degrees,[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-17">17]</a> with Google planning to remove it entirely by Chrome 82. Mozilla is currently discussing proposals, including only removing support for old FTP implementations that are no longer in use to simplify their code.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-18">18]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-19">19]</a></p>
<p><strong>大多数常见的Web浏览器可以检索FTP服务器上托管的文件，尽管它们可能不支持协议扩展，例如FTPS。</strong></p>
<p><strong>当提供FTP（而不是HTTP）URL时，将以与其他Web内容相似的方式显示远程服务器上的可访问内容。功能齐全的FTP客户端可以以Firefox扩展的形式在Firefox中运行。</strong></p>
<p><strong>截至2019年，Chrome和Firefox等主要浏览器都在不同程度上弃用FTP支持， Google计划通过Chrome 82完全删除FTP支持。Mozilla目前正在讨论提案，包括仅删除对不支持旧FTP实现的支持。</strong></p>
</blockquote>
<h3 id="Syntax-（句法）"><a href="#Syntax-（句法）" class="headerlink" title="Syntax （句法）"></a>Syntax （句法）</h3><blockquote>
<p>FTP URL syntax is described in <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc1738">1738</a>, taking the form: <code>ftp://[user[:password]@]host[:port]/url-path</code> (the bracketed parts are optional).</p>
<p>For example, the URL <code>ftp://public.ftp-servers.example.com/mydirectory/myfile.txt</code> represents the file <em><code>myfile.txt</code></em> from the directory <em>mydirectory</em> on the server <code>*public.ftp-servers.example.com*</code>as an FTP resource. The URL <code>ftp://user001:secretpassword@private.ftp-servers.example.com/mydirectory/myfile.txt</code> adds a specification of the username and password that must be used to access this resource.</p>
<p>More details on specifying a username and password may be found in the browsers’ documentation (e.g., <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Firefox">Firefox</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-20">20]</a> and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-21">21]</a>). By default, most web browsers use passive (PASV) mode, which more easily traverses end-user firewalls.</p>
<p>Some variation has existed in how different browsers treat path resolution in cases where there is a non-root home directory for a user.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-22">22]</a></p>
<p><strong>FTP URL语法在RFC 1738中描述，格式为：ftp：// [用户[：密码] @]主机[：端口] / url-path（方括号中的部分是可选的）。</strong></p>
<p><strong>例如，URL 代表服务器public.ftp-servers.example.com上目录mydirectory中的文件myfile.txt作为FTP资源。 。</strong></p>
<p><strong>URL ftp：//user001：<a href="mailto:secretpassword@private.ftp-servers.example.com" rel="external nofollow noreferrer">secretpassword@private.ftp-servers.example.com</a>/mydirectory/myfile.txt添加了用于访问该资源的用户名和密码的规范。</strong></p>
<p><strong>有关指定用户名和密码的更多详细信息，可以在浏览器的文档中找到（例如Firefox [20]和Internet Explorer [21]）。</strong></p>
<p><strong>默认情况下，大多数Web浏览器使用被动（PASV）模式，该模式更容易遍历最终用户防火墙。</strong></p>
<p><strong>在存在用户的非根主目录的情况下，不同的浏览器如何处理路径解析，存在一些差异。[22]</strong></p>
</blockquote>
<h2 id="Security-（安全）"><a href="#Security-（安全）" class="headerlink" title="Security （安全）"></a>Security （安全）</h2><blockquote>
<p>FTP was not designed to be a secure protocol, and has many security weaknesses.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-nurdle-23">23]</a> In May 1999, the authors of <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/RFC_(identifier)">RFC</a> <a target="_blank" rel="noopener external nofollow noreferrer" href="https://tools.ietf.org/html/rfc2577">2577</a> listed a vulnerability to the following problems:</p>
<ul>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Brute-force_attack">Brute-force attack</a></li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/FTP_bounce_attack">FTP bounce attack</a></li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Packet_capture">Packet capture</a></li>
<li>Port stealing (guessing the next open port and usurping a legitimate connection)</li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Spoofing_attack">Spoofing attack</a></li>
<li>Username enumeration</li>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Denial-of-service_attack">DoS or DDoS</a></li>
</ul>
<p>FTP does not encrypt its traffic; all transmissions are in clear text, and usernames, passwords, commands and data can be read by anyone able to perform packet capture (<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Packet_analyzer">sniffing</a>) on the network.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-tcpip-2">2]</a>[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-nurdle-23">23]</a> This problem is common to many of the Internet Protocol specifications (such as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/SMTP">SMTP</a>, <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Telnet">Telnet</a>, POP and IMAP) that were designed prior to the creation of encryption mechanisms such as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Transport_Layer_Security">TLS</a> or SSL.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-clark-4">4]</a></p>
<p>Common solutions to this problem include:</p>
<ol>
<li>Using the secure versions of the insecure protocols, e.g., <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/FTPS">FTPS</a> instead of FTP and TelnetS instead of Telnet.</li>
<li>Using a different, more secure protocol that can handle the job, e.g. <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol">SSH File Transfer Protocol</a> or <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Secure_Copy_Protocol">Secure Copy Protocol</a>.</li>
<li>Using a secure tunnel such as <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Secure_Shell">Secure Shell</a> (SSH) or <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Virtual_private_network">virtual private network</a> (VPN).</li>
</ol>
<p>FTP并非被设计为安全协议，并且具有许多安全漏洞。[23]在1999年5月，RFC 2577的作者列出了一个针对以下问题的漏洞：</p>
<ul>
<li>蛮力攻击</li>
<li>FTP反弹攻击</li>
<li>数据包捕获</li>
<li>端口盗用（猜测下一个开放端口并篡改合法连接）</li>
<li>欺骗攻击</li>
<li>用户名枚举</li>
<li>DoS或DDoS</li>
</ul>
<p>FTP不加密流量。所有传输均以明文形式进行，并且任何能够在网络上执行数据包捕获（嗅探）的人都可以读取用户名，密码，命令和数据。[2] [23]对于创建诸如TLS或SSL之类的加密机制之前设计的许多Internet协议规范（例如SMTP，Telnet，POP和IMAP）来说，这个问题是很常见的。</p>
<p>[4]该问题的常见解决方案包括：</p>
<p>使用不安全协议的安全版本，例如，FTPS代替FTP，TelnetS代替Telnet。<br>使用可以处理作业的其他更安全的协议，例如SSH文件传输协议或安全复制协议。<br>使用安全隧道，例如安全外壳（SSH）或虚拟专用网络（VPN）。</p>
</blockquote>
<h3 id="FTP-over-SSH"><a href="#FTP-over-SSH" class="headerlink" title="FTP over SSH"></a>FTP over SSH</h3><blockquote>
<p>FTP over SSH is the practice of tunneling a normal FTP session over a Secure Shell connection.[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-nurdle-23">23]</a> Because FTP uses multiple <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a> connections (unusual for a TCP/IP protocol that is still in use), it is particularly difficult to tunnel over SSH. With many SSH clients, attempting to set up a tunnel for the control channel (the initial client-to-server connection on port 21) will protect only that channel; when data is transferred, the FTP software at either end sets up new TCP connections (data channels) and thus have no <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Confidentiality">confidentiality</a> or <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Integrity_protection">integrity protection</a>.</p>
<p>Otherwise, it is necessary for the SSH client software to have specific knowledge of the FTP protocol, to monitor and rewrite FTP control channel messages and autonomously open new <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/Packet_forwarding">packet forwardings</a> for FTP data channels. Software packages that support this mode include:</p>
<ul>
<li>Tectia ConnectSecure (Win/Linux/Unix)[<a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol#cite_note-24">24]</a> of <a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/SSH_Communications_Security">SSH Communications Security</a>‘s software suite</li>
</ul>
<p><strong>FTP over SSH是通过安全Shell连接建立普通FTP会话的通道。[23] 由于FTP使用多个TCP连接（对于仍在使用的TCP / IP协议，这是不常见的），因此通过SSH隧道传输特别困难。 对于许多SSH客户端，尝试为控制通道建立隧道（端口21上的初始客户端到服务器连接）将仅保护该通道。 传输数据时，两端的FTP软件都会建立新的TCP连接（数据通道），因此没有机密性或完整性保护。</strong></p>
<p><strong>否则，SSH客户端软件必须具有FTP协议的特定知识，监视和重写FTP控制通道消息并自动打开FTP数据通道的新数据包转发。 支持此模式的软件包包括：</strong></p>
<ul>
<li><strong>SSH Communications Security软件套件的Tectia ConnectSecure（Win / Linux / Unix）[24]</strong></li>
</ul>
</blockquote>
<h2 id="Derivatives-（衍生品、、、）"><a href="#Derivatives-（衍生品、、、）" class="headerlink" title="Derivatives （衍生品、、、）"></a>Derivatives （衍生品、、、）</h2><blockquote>
<ul>
<li>FTPS</li>
<li>SSH File Transfer Protocol</li>
<li>Trivial File Transfer Protocol</li>
<li>Simple File Transfer Protocol</li>
<li>FTP commands</li>
<li>FTP reply codes</li>
</ul>
</blockquote>
<h2 id="Source-of-documentation"><a href="#Source-of-documentation" class="headerlink" title="Source of documentation"></a>Source of documentation</h2><blockquote>
<ol>
<li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://en.wikipedia.org/wiki/File_Transfer_Protocol">https://en.wikipedia.org/wiki/File_Transfer_Protocol</a></li>
</ol>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined" rel="external nofollow noreferrer">伊长空</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://yichangkong.gitee.io/2020/11/12/FTP%20Overview/">https://yichangkong.gitee.io/2020/11/12/FTP%20Overview/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://yichangkong.gitee.io" target="_blank">YiChangKong For Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/">技术文档</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2020/11/14/The%20Key%20To%20Accelerating%20Your%20Coding%20Skills/"><img class="prev-cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200923232742.png" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">The Key To Accelerating Your Coding Skills</div></div></a></div><div class="next-post pull-right"><a href="/2020/11/04/Gang%20of%20Four%20Design%20Patterns%20/"><img class="next-cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201123195941.png" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Gang of Four Design Patterns</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/2020/07/29/Git Command Line/" title="Git Command Line"><img class="cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201123192653.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-07-29</div><div class="title">Git Command Line</div></div></a></div><div><a href="/2020/01/28/H5 Overview/" title="H5 Overview"><img class="cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201122213711.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-01-28</div><div class="title">H5 Overview</div></div></a></div><div><a href="/2020/07/04/HashTable/" title="HashTable"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-07-04</div><div class="title">HashTable</div></div></a></div><div><a href="/2020/04/29/Redis命令行/" title="Redis命令行"><img class="cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200429161847.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-04-29</div><div class="title">Redis命令行</div></div></a></div><div><a href="/2020/09/04/Synchronized in Java/" title="Synchronized in Java"><img class="cover" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-04</div><div class="title">Synchronized in Java</div></div></a></div><div><a href="/2019/11/25/UML Overview/" title="UML Overview"><img class="cover" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201122213024.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2019-11-25</div><div class="title">UML Overview</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20200417183933.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">伊长空</div><div class="author-info__description">空气越稀薄 、风景越广阔</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">45</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">9</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">45</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/CodeSnakes"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/yichangkong" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:changkongyi@gmail.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">繁华落尽一场空 ：风往尘香花已尽 <br> 		<div class="is-center"> 欢迎访问 <br> <a class="bookmark button--primary" id="bookmark-it" href="https://jq.qq.com/?_wv=1027&amp;k=rCby8DjL" rel="external nofollow noreferrer" title="" target="_self"><i aria-hidden="true"> </i><span>Join QQ Group 👍</span></a></div></div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="card-content"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#File-Transfer-Protocol%EF%BC%88-%E6%96%87%E4%BB%B6%E4%BC%A0%E8%BE%93%E5%8D%8F%E8%AE%AE%EF%BC%89"><span class="toc-number">1.</span> <span class="toc-text">File Transfer Protocol（ 文件传输协议）</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#History-of-FTP-servers"><span class="toc-number">2.</span> <span class="toc-text">History of FTP servers</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Protocol-overview-%EF%BC%88%E5%8D%8F%E8%AE%AE%E6%A6%82%E8%BF%B0%EF%BC%89"><span class="toc-number">3.</span> <span class="toc-text">Protocol overview （协议概述）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Communication-and-data-transfer-%EF%BC%88%E9%80%9A%E8%AE%AF%E5%92%8C%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%EF%BC%89"><span class="toc-number">3.1.</span> <span class="toc-text">Communication and data transfer （通讯和数据传输）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#NAT-and-firewall-traversal%EF%BC%88NAT-%E5%92%8C-%E9%98%B2%E7%81%AB%E5%A2%99%E7%A9%BF%E8%B6%8A%EF%BC%89"><span class="toc-number">3.2.</span> <span class="toc-text">NAT and firewall traversal（NAT 和 防火墙穿越）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Data-types%EF%BC%88%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%EF%BC%89"><span class="toc-number">3.3.</span> <span class="toc-text">Data types（数据类型）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#File-structures%EF%BC%88%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84%EF%BC%89"><span class="toc-number">3.4.</span> <span class="toc-text">File structures（文件结构）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Data-transfer-modes-%EF%BC%88%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E6%A8%A1%E5%9E%8B-%E6%96%B9%E5%BC%8F%EF%BC%89"><span class="toc-number">3.5.</span> <span class="toc-text">Data transfer modes （数据传输模型\方式）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Login-%EF%BC%88%E7%99%BB%E9%99%86%EF%BC%89"><span class="toc-number">4.</span> <span class="toc-text">Login （登陆）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Anonymous-FTP-%EF%BC%88%E5%8C%BF%E5%90%8D-FTP%EF%BC%89"><span class="toc-number">4.1.</span> <span class="toc-text">Anonymous FTP （匿名 FTP）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Differences-from-HTTP-%EF%BC%88%E4%B8%8EHTTP%E7%9A%84%E4%B8%8D%E5%90%8C%E4%B9%8B%E5%A4%84%EF%BC%89"><span class="toc-number">5.</span> <span class="toc-text">Differences from HTTP （与HTTP的不同之处）</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Web-browser-support-%EF%BC%88%E7%BD%91%E7%AB%99%E6%B5%8F%E8%A7%88%E5%99%A8%E6%94%AF%E6%8C%81%EF%BC%89"><span class="toc-number">6.</span> <span class="toc-text">Web browser support （网站浏览器支持）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Syntax-%EF%BC%88%E5%8F%A5%E6%B3%95%EF%BC%89"><span class="toc-number">6.1.</span> <span class="toc-text">Syntax （句法）</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Security-%EF%BC%88%E5%AE%89%E5%85%A8%EF%BC%89"><span class="toc-number">7.</span> <span class="toc-text">Security （安全）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#FTP-over-SSH"><span class="toc-number">7.1.</span> <span class="toc-text">FTP over SSH</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Derivatives-%EF%BC%88%E8%A1%8D%E7%94%9F%E5%93%81%E3%80%81%E3%80%81%E3%80%81%EF%BC%89"><span class="toc-number">8.</span> <span class="toc-text">Derivatives （衍生品、、、）</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Source-of-documentation"><span class="toc-number">9.</span> <span class="toc-text">Source of documentation</span></a></li></ol></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2022/04/28/JOIN-Clause/" title="JOIN_Clause"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JOIN_Clause"/></a><div class="content"><a class="title" href="/2022/04/28/JOIN-Clause/" title="JOIN_Clause">JOIN_Clause</a><time datetime="2022-04-28T15:42:04.000Z" title="发表于 2022-04-28 23:42:04">2022-04-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/03/24/Vim%E9%94%AE%E4%BD%8D%E5%9B%BE/" title="Vim键位图"><img src="https://gitee.com/yichangkong/FigureBed/raw/master/img/vi-vim-cheat-sheet-sch.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Vim键位图"/></a><div class="content"><a class="title" href="/2022/03/24/Vim%E9%94%AE%E4%BD%8D%E5%9B%BE/" title="Vim键位图">Vim键位图</a><time datetime="2022-03-24T03:32:15.000Z" title="发表于 2022-03-24 11:32:15">2022-03-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/01/12/requirejs%20Overview/" title="RequireJs Overview"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="RequireJs Overview"/></a><div class="content"><a class="title" href="/2021/01/12/requirejs%20Overview/" title="RequireJs Overview">RequireJs Overview</a><time datetime="2021-01-12T02:43:34.000Z" title="发表于 2021-01-12 10:43:34">2021-01-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/12/12/SSM%E6%9E%B6%E6%9E%84%E4%B8%8B%E7%9A%84Cors%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" title="SSM架构下的Cors跨域问题"><img src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201213132701.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SSM架构下的Cors跨域问题"/></a><div class="content"><a class="title" href="/2020/12/12/SSM%E6%9E%B6%E6%9E%84%E4%B8%8B%E7%9A%84Cors%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" title="SSM架构下的Cors跨域问题">SSM架构下的Cors跨域问题</a><time datetime="2020-12-12T13:13:28.000Z" title="发表于 2020-12-12 21:13:28">2020-12-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2020/11/25/DataTable/" title="DataTable"><img src="https://gitee.com/yichangkong/FigureBed/raw/master/img/20201125100521.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="DataTable"/></a><div class="content"><a class="title" href="/2020/11/25/DataTable/" title="DataTable">DataTable</a><time datetime="2020-11-25T01:45:41.000Z" title="发表于 2020-11-25 09:45:41">2020-11-25</time></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By 伊长空</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    let initData = {
      el: '#vcomment',
      appId: 'xuXblFdHlR0fcnQsdkLwkqvG-gzGzoHsz',
      appKey: 'ac3XS1leXcL95PWUhYV6gx0E',
      placeholder: 'Please leave your footprints',
      avatar: 'retro',
      meta: 'nick,mail'.split(','),
      pageSize: '10',
      lang: 'en',
      recordIP: false,
      serverURLs: '',
      emojiCDN: 'https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/',
      emojiMaps: {"tv_doge":"6ea59c827c414b4a2955fe79e0f6fd3dcd515e24.png","tv_亲亲":"a8111ad55953ef5e3be3327ef94eb4a39d535d06.png","tv_偷笑":"bb690d4107620f1c15cff29509db529a73aee261.png","tv_再见":"180129b8ea851044ce71caf55cc8ce44bd4a4fc8.png","tv_冷漠":"b9cbc755c2b3ee43be07ca13de84e5b699a3f101.png","tv_发怒":"34ba3cd204d5b05fec70ce08fa9fa0dd612409ff.png","tv_发财":"34db290afd2963723c6eb3c4560667db7253a21a.png","tv_可爱":"9e55fd9b500ac4b96613539f1ce2f9499e314ed9.png","tv_吐血":"09dd16a7aa59b77baa1155d47484409624470c77.png","tv_呆":"fe1179ebaa191569b0d31cecafe7a2cd1c951c9d.png","tv_呕吐":"9f996894a39e282ccf5e66856af49483f81870f3.png","tv_困":"241ee304e44c0af029adceb294399391e4737ef2.png","tv_坏笑":"1f0b87f731a671079842116e0991c91c2c88645a.png","tv_大佬":"093c1e2c490161aca397afc45573c877cdead616.png","tv_大哭":"23269aeb35f99daee28dda129676f6e9ea87934f.png","tv_委屈":"d04dba7b5465779e9755d2ab6f0a897b9b33bb77.png","tv_害羞":"a37683fb5642fa3ddfc7f4e5525fd13e42a2bdb1.png","tv_尴尬":"7cfa62dafc59798a3d3fb262d421eeeff166cfa4.png","tv_微笑":"70dc5c7b56f93eb61bddba11e28fb1d18fddcd4c.png","tv_思考":"90cf159733e558137ed20aa04d09964436f618a1.png","tv_惊吓":"0d15c7e2ee58e935adc6a7193ee042388adc22af.png"},
      enableQQ: false,
      path: window.location.pathname,
    }

    if (true) { 
      initData.requiredFields= ('nick'.split(','))
    }
    
    if (false) {
      const otherData = false
      initData = Object.assign({}, initData, otherData)
    }
    
    const valine = new Valine(initData)
  }

  if (typeof Valine === 'function') initValine() 
  else $.getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js', initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.querySelector('#vcomment'),loadValine)
  else setTimeout(() => loadValine(), 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src="https://cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script></div></body></html>